<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>e-MarioSakoban:  Fichier source de /home/ychoucha/cours_IUT/Programmation/C/sakoban_project/src/editeur.c</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Généré par Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Page&nbsp;principale</span></a></li>
      <li><a href="annotated.html"><span>Structures&nbsp;de&nbsp;données</span></a></li>
      <li class="current"><a href="files.html"><span>Fichiers</span></a></li>
    </ul>
  </div>
<h1>/home/ychoucha/cours_IUT/Programmation/C/sakoban_project/src/editeur.c</h1><a href="editeur_8c.html">Aller à la documentation de ce fichier.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment">editeur.c</span>
<a name="l00003"></a>00003 <span class="comment">------</span>
<a name="l00004"></a>00004 <span class="comment">Issa</span>
<a name="l00005"></a>00005 <span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment">Rôle : editeur du jeu, permettant de créer ces niveaux personalisé</span>
<a name="l00007"></a>00007 <span class="comment">*/</span>
<a name="l00008"></a>00008 
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#include "<a class="code" href="allInclude_8h.html">allInclude.h</a>"</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 
<a name="l00013"></a><a class="code" href="editeur_8c.html#aa48acf632480e61a8ceb716be29c1ab">00013</a> <span class="keywordtype">void</span> <a class="code" href="editeur_8h.html#26cb221102473666421ce71c686c8e11">cb_down</a>(<span class="keywordtype">void</span> *data, Evas *evas, Evas_Object *obj, <span class="keywordtype">void</span> *event_info)
<a name="l00014"></a>00014 {
<a name="l00015"></a>00015          Evas_Event_Mouse_Down *event;
<a name="l00016"></a>00016          Evas_Event_Mouse_Move *eventMove;
<a name="l00017"></a>00017 
<a name="l00018"></a>00018         <span class="keyword">event</span> = (Evas_Event_Mouse_Down *)event_info;
<a name="l00019"></a>00019         <span class="keywordflow">if</span> (event-&gt;button == 1 )
<a name="l00020"></a>00020         {
<a name="l00021"></a>00021        evas_object_move (obj,event-&gt;output.x, event-&gt;output.y); <span class="comment">// position du réctangle dans notre fenetre</span>
<a name="l00022"></a>00022         }
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 evas_object_move (obj,eventMove-&gt;cur.output.x, eventMove-&gt;cur.output.y);
<a name="l00025"></a>00025 }
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="editeur_8c.html#ad9a7791fc5b9703cc7e7c365c313e53">00027</a> <span class="keywordtype">void</span> <a class="code" href="editeur_8h.html#ad9a7791fc5b9703cc7e7c365c313e53">editeurLevel</a>(Ecore_Evas *ecran,Evas *evas,Evas_Object *o)
<a name="l00028"></a>00028  {
<a name="l00029"></a>00029         printf(<span class="stringliteral">"Editeur\n"</span>);
<a name="l00030"></a>00030 
<a name="l00031"></a>00031     <a class="code" href="structpositionJoueur.html">positionJoueur</a> *marioPosition;
<a name="l00032"></a>00032     marioPosition = malloc(<span class="keyword">sizeof</span>(<a class="code" href="structpositionJoueur.html">positionJoueur</a>));
<a name="l00033"></a>00033 
<a name="l00034"></a>00034     Evas_Object *mur,*vide, *caisseOK = NULL, *objectif = NULL, *fondEcran;
<a name="l00035"></a>00035 
<a name="l00036"></a>00036     <span class="keywordtype">int</span> i, j;
<a name="l00037"></a>00037     <span class="keywordtype">int</span> positionX,positionY;
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="comment">// Chargement du niveau</span>
<a name="l00041"></a>00041     <span class="keywordflow">if</span> (!<a class="code" href="fichiers_8h.html#cf0da640847485f50de7a2bf002b7784">chargerNiveau</a>(marioPosition-&gt;<a class="code" href="structpositionJoueur.html#59a663d85bf1fcd60404abf260212805">carte</a>))
<a name="l00042"></a>00042         exit(EXIT_FAILURE); <span class="comment">// On arrête le jeu si on n'a pas pu charger le niveau</span>
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 
<a name="l00045"></a>00045     fondEcran = evas_object_rectangle_add (evas); <span class="comment">// création de l'objet rectangle dans l'evas</span>
<a name="l00046"></a>00046     evas_object_color_set (fondEcran,255, 255,255, 255); <span class="comment">// couleur du rectangle</span>
<a name="l00047"></a>00047     evas_object_resize(fondEcran, <a class="code" href="constantes_8h.html#6068a247ff9ece1b0a9773c58144906c">LARGEUR_FENETRE</a>, <a class="code" href="constantes_8h.html#fd1a1e285af564b849b17498e82e1a41">HAUTEUR_FENETRE</a>); <span class="comment">// taille du rectangle</span>
<a name="l00048"></a>00048     evas_object_move (fondEcran, 0, 0); <span class="comment">// position du réctangle dans notre fenetre</span>
<a name="l00049"></a>00049     evas_object_show (fondEcran); <span class="comment">// Mise à jour de l'écran</span>
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 
<a name="l00052"></a>00052     <span class="comment">// Placement des objets à l'écran</span>
<a name="l00053"></a>00053     <span class="keywordflow">for</span> (i = 0 ; i &lt; <a class="code" href="constantes_8h.html#5b621c07985e98b04fc2d2195b85ad69">NB_BLOCS_LARGEUR</a> ; i++)
<a name="l00054"></a>00054     {
<a name="l00055"></a>00055         <span class="keywordflow">for</span> (j = 0 ; j &lt; <a class="code" href="constantes_8h.html#d0de8de53b10369f89648fed34ce16c9">NB_BLOCS_HAUTEUR</a> ; j++)
<a name="l00056"></a>00056         {
<a name="l00057"></a>00057             positionX = i * <a class="code" href="constantes_8h.html#bad9ad5ae94fd56569e71c156349030b">TAILLE_BLOC</a>;
<a name="l00058"></a>00058             positionY = j * TAILLE_BLOC;
<a name="l00059"></a>00059             evas_object_show (<a class="code" href="gestionImages_8h.html#3cf3ff9855e9ba44368b3f75796e811f">murMove</a>(mur,evas,positionX,positionY));
<a name="l00060"></a>00060         }
<a name="l00061"></a>00061     }
<a name="l00062"></a>00062    vide = <a class="code" href="gestionImages_8h.html#db0c50da7f1f0a78da997497338e80d6">videMove</a>(vide,evas,12,12);
<a name="l00063"></a>00063  evas_object_show (vide);
<a name="l00064"></a>00064     evas_object_focus_set(fondEcran, 1);
<a name="l00065"></a>00065     evas_object_event_callback_add(fondEcran, EVAS_CALLBACK_MOUSE_DOWN, <a class="code" href="editeur_8h.html#26cb221102473666421ce71c686c8e11">cb_down</a>, marioPosition);
<a name="l00066"></a>00066 
<a name="l00067"></a>00067  }
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Généré le Sun Apr 5 18:14:18 2009 pour e-MarioSakoban par&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>
